/* jshint esversion: 6 */
var mini_host = 'http://wine.youzhenjx.com';

var goodsList = (name, page, pagesize) => {
    return new Promise((resolve, reject) => {
        $.post(mini_host + '/index/Api/goodsList', {one_type_id: 1, name, page, pagesize}, res => {
            resolve(res);  // 请求成功时调用 resolve
        }, 'json').fail(err => {
            reject(err);  // 请求失败时调用 reject
        });
    });
};

var orderList = (name, page, pagesize) => {
    return new Promise((resolve, reject) => {
        $.post(mini_host + '/index/Api/orderList', {one_type_id: 1, name, page, pagesize}, res => {
            resolve(res);  // 请求成功时调用 resolve
        }, 'json').fail(err => {
            reject(err);  // 请求失败时调用 reject
        });
    });
};

var sonList = (mobile, page, pagesize) => {
    return new Promise((resolve, reject) => {
        $.post('/index/team/sonList', {mobile, page, pagesize}, res => {
            resolve(res);  // 请求成功时调用 resolve
        }, 'json').fail(err => {
            reject(err);  // 请求失败时调用 reject
        });
    });
};

var scoreList = (page, pagesize) => {
    return new Promise((resolve, reject) => {
        $.post('/index/user/scoreList', {page, pagesize}, res => {
            resolve(res);  // 请求成功时调用 resolve
        }, 'json').fail(err => {
            reject(err);  // 请求失败时调用 reject
        });
    });
};

var moveScoreToMini = (score) => {
    return new Promise((resolve, reject) => {
        $.post('/index/user/moveScoreToMini', {score}, res => {
            resolve(res);  // 请求成功时调用 resolve
        }, 'json').fail(err => {
            reject(err);  // 请求失败时调用 reject
        });
    });
};